@{repository.loading = true}

<h1>@{title}</h1>

<div class="row">

	<div class="col-md-4 m">

		<div class="keyvalue npt">
			<div class="key">@(Account name)</div>
			<div class="value">@{user.name}</div>
		</div>

		<div class="keyvalue">
			<div class="key">@(Email address)</div>
			<div class="value">@{user.email}</div>
		</div>

		<div class="keyvalue">
			<div class="key">@(Phone number)</div>
			<div class="value">@{if user.phone}@{user.phone}@{else}@(undefined)@{fi}</div>
		</div>

		<div class="keyvalue">
			<div class="key">@(Discount)</div>
			<div class="value">@{user.discount.format(2)}%</div>
		</div>
		<br />

		<div>
			<a href="@{sitemap_url('settings')}" class="link"><i class="fa fa-caret-right"></i>@(Update account)</a>
			<a href="@{sitemap_url('category')}" class="link"><i class="fa fa-caret-right"></i>@(Browse goods)</a>
		</div>

	</div>

	<div class="col-md-8 m">
		<div class="content">
			<div class="contentbody npb">
				<div class="caption">@(My orders) (<b data-b="orders" data-b-html="value ? value.length : 0"></b>)</div>
			</div>
			<div data-b="orders" data-b-visible="!value || !value.length" class="hidden">
				<div class="empty"><i class="fa fa-dropbox"></i>@(You don't have any orders.)</div>
			</div>
			<div data-b="orders" data-b-template="true" class="hidden" data-b-visible="value && value.length">
				<script type="text/html">
					{{ foreach m in value }}
						<div class="order">
							<a href="@{sitemap_url('order', '{{ m.id }}')}" title="@(Preview)"><i class="fa fa-search"></i></a>
							<div class="line">
								<div class="price">{{ m.price | format(2) }}</div>
								<div class="name">{{ m.name }}</div>
							</div>
							<div class="line">
								<div class="date">{{ m.datecreated | format('@(yyyy-MM-dd HH:mm)') }}</div>
								<div class="status">{{ if m.isfinished }}<b class="green"><i class="fa fa-check-circle"></i>@(Finished)</b>{{ else }}{{ m.status }}{{ fi }}</div>
							</div>
						</div>
					{{ end }}
				</script>
			</div>
		</div>
	</div>

</div>

<script>
	SETTER(true, 'loading', 'hide', 1000);
	AJAXCACHE('GET /api/account/orders/', 'orders', '1 minute');
</script>